<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=640,user-scalable=no" />
		<title>生成喜宴</title>
        <script>
             var jsonDataObj = <?php echo $jsonDataObj;?>;
             console.log(jsonDataObj)
             var userUrl = {"name":"<?php echo $userInfo['name'];?>;","url":"<?php echo $userInfo['image'];?>"};
        </script>
		<link rel="stylesheet" type="text/css" href="<?php echo  C('HTTP_HOST_URL');?>/Public/game/css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo  C('HTTP_HOST_URL');?>/Public/game/css/desk.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo  C('HTTP_HOST_URL');?>/Public/game/css/createBanquet.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo  C('HTTP_HOST_URL');?>/Public/game/css/animate.css"/>
	</head>
	<body>
        <include file="./Application/Home/View/Page/wechatsdk.html" />
		<div class="web">
			<!--页面进入时触发的遮罩-->
			<div class="welcome">
				<!--第一个首页生成宴席时的欢迎语-->
				<div class="animated bounceIn">
					囍席摆好了,<br />快邀请亲朋好友入席!
					<div class="remove">X</div>
				</div>
				<!--第二个首页朋友进入席位时的欢迎语,默认隐藏,专属样式名字为.btns_f-->
				<div class="btns btns_f animated bounceIn">
                    欢迎来到{$BanquetInfo.wx_name}的宴席<br />
					<button>我要入席</button><br />
					<button>查看宴席排行榜</button><br />
					<button>我要制作我的宴席</button><br />
					<div class="remove">X</div>
				</div>
				<!--第三个首页我要入榜时的欢迎语,默认隐藏,专属样式名字为.btns_s-->
				<div class="btns btns_s animated bounceIn">
                    欢迎来到{$BanquetInfo.wx_name}的宴席<br />
					<button>我要入榜,<br />赢取999元现金</button><br />
					<button>查看宴席排行榜</button><br />
					<div class="remove">X</div>
				</div>
				<!--第三个首页我要入榜时的欢迎语,默认隐藏-->
				<div class="btns btns_t animated bounceIn">
					为Ta收集更多新婚祝福!
					<div class="remove">X</div>
				</div>
			</div>
			<!--页面正文标题部分-->
			<!--第二,三首页进入时标题内容隐藏,但为防止中间桌子的内容部分顶到顶部,请给.title设置30px的高度-->
			<div class="title">
                <input type="text" value="{$BanquetInfo['wx_name']}"/><span>家的囍宴</span>
			</div>
			<!--页面正文的桌子部分-->
			<div class="content">
                
				<div class="desk_wrap desk_b" data-index=0>
				<div class="desk">
					<div class="cencir"><p>主宾桌</p></div>
                    
                    <?php for($i=0;$i<=5;$i++):?>
					<div class="seat seat<?php echo $i+1;?>" data-index=<?php echo $i;?>>
                         <div class="seated addP" banquet_id="{$mainTableData.banquet_id}" table_id="{$mainTableData.id}" position="<?php echo $i+1;?>"><img src="/Public/game/images/seated_bg.png"  /></div>
					</div>
                    <?php endfor;?>
                    
				</div>
				</div>
                
                
                
                <foreach name="listTableData" item="item" key="key" >  
                <div class="desk_wrap desk_s" data-index={$item.position}>
                    <div class="desk">
                        <div class="cencir"><p>{$item.table_name}</p></div>
                        
                    <?php for($i=0;$i<=5;$i++):?>
					<div class="seat seat<?php echo $i+1;?>" data-index=<?php echo $i;?>>
						<div class="seated addP" banquet_id="{$item.banquet_id}" table_id="{$item.id}" position="<?php echo $i+1;?>"><img src="/Public/game/images/seated_bg.png"  /></div>
					</div>
                    <?php endfor;?>
                    </div>
				</div>
                </foreach>
                

                
				<div class="desk_wrap desk_s" data-index=6>
				<div class="desk">
					
					<div class="cencir"><p>+</p></div>
					<div class="seat seat1" data-index=0>
						<div class="seated"></div>
					</div>
					<div class="seat seat2" data-index=1>
						<div class="seated "></div>
					</div>
					<div class="seat  seat3" data-index=2>
						<div class="seated"></div>
					</div>
					<div class="seat  seat4" data-index=3>
						<div class="seated"></div>
					</div>
					<div class="seat  seat5" data-index=4>
						<div class="seated"></div>
					</div>
					<div class="seat seat6" data-index=5>
						<div class="seated "></div>
					</div>
				</div>
				</div>
			</div>
			<!--页面正文尾部-->
			<div class="footer">
				<!--第一个首页的底部-->
				<div class="btn">
					生成囍宴,分享囍事
				</div>
				<!--第二/三个首页的脚步,默认为display:none-->
				<div class="btns_f">
					您是第<?php echo $BanquetInfo['people'];?>位宾客,目前已有<?php echo $BanquetInfo['people']-1;?>位宾客入席
				</div>
			</div>
			
			<!--桌子切换变大时动态的页脚内容-->
			<div class="mask">
				<p>您已成功入席</p>
				您的座位是<span class="fa_pos">-</span>桌
				第<span class="sel_pos">-</span>位
			</div>
		</div>
		<!--返回首页-->
		<div class="bot">
			<button></button>
		</div>
        <input type="hidden" class="hasP" value="{$hasP}"/>
        
        <script src="<?php echo  C('HTTP_HOST_URL');?>/Public/game/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="<?php echo  C('HTTP_HOST_URL');?>/Public/game/js/desk.js" type="text/javascript" charset="utf-8"></script>
		<script src="<?php echo  C('HTTP_HOST_URL');?>/Public/game/js/jquery.transit.js" type="text/javascript" charset="utf-8"></script>
		<script src="<?php echo  C('HTTP_HOST_URL');?>/Public/game/js/jQuery.md5.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
            
            function showwel(n){
                $(".welcome").css("display","block");
                //第一个首页欢迎语出现,第二三个欢迎隐藏
                if(n==1){
                    $(".welcome div:first").css("display","block");
                    $(".btns_f").css("display","none");
                    $(".btns_s").css("display","none");
                    $(".btns_t").css("display","none");
                };
                //第二个首页欢迎语出现,第一三个欢迎隐藏
                if(n==2){
                    $(".welcome div:first").css("display","none");
                    $(".btns_s").css("display","none");
                    $(".btns_f").css("display","block");
                    $(".btns_t").css("display","none");
                };
                //第三个首页欢迎语出现,第一二个欢迎隐藏
                if(n==3){
                    $(".welcome div:first").css("display","none");
                    $(".btns_t").css("display","none");
                    $(".btns_s").css("display","block");
                    $(".btns_f").css("display","none");
                }
            }
            
            
            
            
            
            
            var number = 'lkasdj213489ulkjadsf';
            $(".addP").click(function(){
                var hasp = $(".hasP").val();
                if(hasp == 1){
                    alert("您已经参加该宴会了哦");
                } else {
                    $(this).find("img:eq(0)").attr('src',"<php>echo $userInfo['image'];</php>");              
                    var banquet_id = $(this).attr('banquet_id');
                    var table_id = $(this).attr('table_id');
                    var position = $(this).attr('position');
                    var postData = {"banquet_id":banquet_id,"table_id":table_id,"position":position};

                    var qwer = JSON.stringify(postData);
                    var asdf = $.md5(qwer + number);
                    var url = '<php>echo \Org\Net\Fun::url("home/page/addParticipate")</php>';

                    var postData = {'qwer':qwer,"session_id":asdf};
                    $.post(url,postData,function(data){
                        alert(data.message);
                        if(data.state == 1){
                            $(".hasP").val(1);
                        }
                    },"json");
                }
            });

            
            //如果宴会主人用户ID不等于登陆ID，表示是朋友来的，显示对应的弹出层 begin
            <?php if($BanquetInfo['wx_id'] != $userInfo['wx_id']):?>
                showwel(2);
            <?php endif;?>
            //如果宴会主人用户ID不等于登陆ID，表示是朋友来的，显示对应的弹出层 end
           
            <?php if($BanquetInfo['wx_id'] == $userInfo['wx_id'] && $isWeb==0):?>
                showwel(3); 
            <?php endif;?>
		
        $(".bot button").on("click",function(){
            location.href="<php>echo \Org\Net\Fun::url('home/page/index');</php>";
        });
		$(".btns_f button:first").on("click",function(){
			$(".welcome").css("display","none");
		});
        
        //查看宴会排行榜
		$(".btns_f button:nth-of-type(2)").on("click",function(){
			location.href = "<php>echo \Org\Net\Fun::url('home/page/rankingList');</php>"
		})
        //第二个弹出层的我要制造我的宴席
		$(".btns_f button:nth-of-type(3)").on("click",function(){
            location.href = "<php>echo \Org\Net\Fun::url('home/page/index');</php>";
		});
        
        
        //第三个弹出层，我要入榜
		$(".btns_s button:nth-of-type(1)").on("click",function(){
            location.href = "<php>echo \Org\Net\Fun::url('home/page/information');</php>";
		})
        //第三个弹出层，查看排行榜
		$(".btns_s button:nth-of-type(2)").on("click",function(){
            location.href = "<php>echo \Org\Net\Fun::url('home/page/rankingList');</php>";
			//location.href = "Ranking.html"
		})
		//第一个首页底部的链接弹出	
		$(".footer .btn").on("click",function(){
			$(".welcome").css("display","block");
			$(".btns_t").css("display","block").siblings().css("display","none");
		})
		
		</script>
	
	
	</body>
</html